<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <title>4S cafe会员权益说明</title>
    <link rel="stylesheet" href="./css/swiper.min.css">
    <link rel="stylesheet" href="css/rights.css">
    <script src="http://code.jquery.com/jquery-3.2.1.min.js"></script>
    <script>
        // 适配所有移动端，1rem=100px
        !function (d) {
            var c = d.document;
            var a = c.documentElement;
            var b = d.devicePixelRatio;
            var f;
            function e() {
                var h = a.getBoundingClientRect().width, g;
                if (b === 1) {
                    h = 750
                }
                if (h > 750)
                    h = 750;//设置基准值的极限值
                g = h / 7.5;
                a.style.fontSize = g + "px"
            }
            if (b > 2) {
                b = 3
            } else {
                if (b > 1) {
                    b = 2
                } else {
                    b = 1
                }
            }
            a.setAttribute("data-dpr", b);
            d.addEventListener("resize", function () {
                clearTimeout(f);
                f = setTimeout(e, 200)
            }, false);
            e()
        }(window);
    </script>
</head>
<body>
    <div id="boxs">
        <header>
            <img src="./images/explain.png" alt="">
        </header>
        <div class="contents">
            <!-- swiper插件start -->
            <div class="swiper-container">
                <div class="swiper-button-prev"></div>
                <div class="swiper-button-next"></div>
                <div class="swiper-wrapper">
                    <div class="swiper-slide">
                        <img src="./images/card1.png" alt="">
                    </div>
                    <div class="swiper-slide">
                        <img src="./images/card2.png" alt="">
                    </div>
                    <div class="swiper-slide">
                        <img src="./images/card3.png" alt="">
                    </div>
                    <div class="swiper-slide">
                        <img src="./images/card4.png" alt="">
                    </div>
                </div>
            </div>
            <!-- swiper插件end -->
            <div class="prompt">
                <img src="./images/prompt.png" alt="">
            </div>
            <div class="line">
                <img src="./images/line.png" alt="">
            </div>
            <!-- 会员权益容器start -->
            <div class="allContent">
                <!--  普通会员start  -->
                <div class="allAct">
                    <div class="act1 act">
                        <img src="./images/icon1.png" alt="">
                        <div>
                            <p>入场礼券</p>
                            <p><img src="./images/rect.png" alt="">5元咖啡体验券</p>
                            <p><img src="./images/rect.png" alt="">价值120元的咖<br/><span style="white-space:nowrap;">啡券和糕点代金券</span></p>
                        </div>
                    </div>
                    <div class="act2 act">
                        <img src="./images/icon2.png" alt="">
                        <div>
                            <p>每周会员日</p>
                            <p><img src="./images/rect.png" alt="">指定单品5折</p>
                        </div>
                    </div>
                    <div class="act3 act">
                        <img src="./images/icon3.png" alt="">
                        <div>
                            <p>打折券</p>
                            <p><img src="./images/rect.png" alt="">手冲咖啡9折券</p>
                        </div>
                    </div>
                    <div class="act4 act">
                        <img src="./images/icon4.png" alt="">
                        <div>
                            <p>包场优惠</p>
                            <p><img src="./images/rect.png" alt="">包场9折</p>
                        </div>
                    </div>
                </div>
                <!--  普通会员end  -->
                <!--  银牌会员start  -->
                <div class="allAct2">
                    <div class="act1 act">
                        <img src="./images/icon21.png" alt="">
                        <div>
                            <p>入场礼券</p>
                            <p><img src="./images/rect2.png" alt="">5元咖啡体验券</p>
                            <p><img src="./images/rect2.png" alt="">价值120元的咖<br/><span style="white-space:nowrap;">啡券和糕点代金券</span></p>
                        </div>
                    </div>
                    <div class="act2 act">
                        <img src="./images/icon22.png" alt="">
                        <div>
                            <p>每周会员日</p>
                            <p><img src="./images/rect2.png" alt="">指定单品5折</p>
                        </div>
                    </div>
                    <div class="act3 act">
                        <img src="./images/icon23.png" alt="">
                        <div>
                            <p>打折券</p>
                            <p><img src="./images/rect2.png" alt="">手冲咖啡8折券</p>
                        </div>
                    </div>
                    <div class="act4 act">
                        <img src="./images/icon24.png" alt="">
                        <div>
                            <p>免费赠饮</p>
                            <p><img src="./images/rect2.png" alt="">2张赠饮券</p>
                        </div>
                    </div>
                    <div class="act5 act">
                        <img src="./images/icon25.png" alt="">
                        <div>
                            <p>会员升级礼</p>
                            <p><img src="./images/rect2.png" alt="">4SCAFE杯1套</p>
                        </div>
                    </div>
                    <div class="act6 act">
                        <img src="./images/icon26.png" alt="">
                        <div>
                            <p>包场优惠</p>
                            <p><img src="./images/rect2.png" alt="">包场8折</p>
                        </div>
                    </div>
                </div>
                <!--  银牌会员end  -->
                <!--  金牌会员start  -->
                <div class="allAct3">
                    <div class="act1 act">
                        <img src="./images/icon31.png" alt="">
                        <div>
                            <p>入场礼券</p>
                            <p><img src="./images/rect3.png" alt="">5元咖啡体验券</p>
                            <p><img src="./images/rect3.png" alt="">价值120元的咖<br/><span style="white-space:nowrap;">啡券和糕点代金券</span></p>
                        </div>
                    </div>
                    <div class="act2 act">
                        <img src="./images/icon32.png" alt="">
                        <div>
                            <p>每周会员日</p>
                            <p><img src="./images/rect3.png" alt="">指定单品5折</p>
                            <p><img src="./images/rect3.png" alt="">饮品买2送1</p>
                        </div>
                    </div>
                    <div class="act3 act">
                        <img src="./images/icon33.png" alt="">
                        <div>
                            <p>打折券</p>
                            <p><img src="./images/rect3.png" alt="">手冲咖啡7折券</p>
                        </div>
                    </div>
                    <div class="act4 act">
                        <img src="./images/icon34.png" alt="">
                        <div>
                            <p>免费赠饮</p>
                            <p><img src="./images/rect3.png" alt="">3张赠饮券</p>
                        </div>
                    </div>
                    <div class="act5 act">
                        <img src="./images/icon35.png" alt="">
                        <div>
                            <p>会员升级礼</p>
                            <p><img src="./images/rect3.png" alt="">4SCAFE杯1套</p>
                            <p><img src="./images/rect3.png" alt="">挂耳咖啡礼盒1盒</p>
                        </div>
                    </div>
                    <div class="act6 act">
                        <img src="./images/icon36.png" alt="">
                        <div>
                            <p>包场优惠</p>
                            <p><img src="./images/rect3.png" alt="">包场7折</p>
                        </div>
                    </div>
                </div>
                <!--  金牌会员end  -->
                <!--  钻石会员start  -->
                <div class="allAct4">
                    <div class="act1 act">
                        <img src="./images/icon41.png" alt="">
                        <div>
                            <p>入场礼券</p>
                            <p><img src="./images/rect4.png" alt="">5元咖啡体验券</p>
                            <p><img src="./images/rect4.png" alt="">价值120元的咖<br/><span style="white-space:nowrap;">啡券和糕点代金券</span></p>
                        </div>
                    </div>
                    <div class="act2 act">
                        <img src="./images/icon42.png" alt="">
                        <div>
                            <p>每周会员日</p>
                            <p><img src="./images/rect4.png" alt="">指定单品5折</p>
                            <p><img src="./images/rect4.png" alt="">饮品买1送1</p>
                        </div>
                    </div>
                    <div class="act3 act">
                        <img src="./images/icon43.png" alt="">
                        <div>
                            <p>打折券</p>
                            <p><img src="./images/rect4.png" alt="">手冲咖啡6折券</p>
                        </div>
                    </div>
                    <div class="act4 act">
                        <img src="./images/icon44.png" alt="">
                        <div>
                            <p>免费赠饮</p>
                            <p><img src="./images/rect4.png" alt="">5张赠饮券</p>
                        </div>
                    </div>
                    <div class="act5 act">
                        <img src="./images/icon45.png" alt="">
                        <div>
                            <p>会员升级礼</p>
                            <p><img src="./images/rect4.png" alt="">4SCAFE杯1套</p>
                            <p><img src="./images/rect4.png" alt="">挂耳咖啡礼盒1盒</p>
                            <p style="font-size:.22rem;color:#4d4d4d;white-space:nowrap;"><img src="./images/rect4.png" alt="">精品磨豆机1个</p>
                        </div>
                    </div>
                    <div class="act6 act">
                        <img src="./images/icon46.png" alt="">
                        <div>
                            <p>包场优惠</p>
                            <p><img src="./images/rect4.png" alt="">包场6折</p>
                        </div>
                    </div>
                </div>
                <!--  钻石会员end  -->
            </div>
            <!-- 会员权益容器end -->
            <div class="line" style="margin-top:-.5rem;">
                <img src="./images/line.png" alt="">
            </div>
            <!-- 部分安卓手机点击图片放大，醉了，因此加了个点击事件 -->
            <div class="join" onclick="return false;">
                <img src="./images/footer.png" alt="">
            </div>
        </div>
        <!-- 立即入会start -->
        <footer>
            <img src="./images/join.png" alt="" onclick="window.location.href='http://carnt.carnettong.com:8088/4SCAFE/HTML5/aTestWx/dist/index.html'">
        </footer>
        <!-- 立即入会end -->
    </div>
    <script src="./js/swiper.min.js"></script>
    <script>
        var swiper = new Swiper({
            el: '.swiper-container',
            initialSlide: 0,//初始位置，如为2则初始为第三个图片
            speed: 500,//速度快慢，越大越慢
            preventLinksPropagation : true,//阻止click冒泡。拖动Swiper时阻止click事件。
            centeredSlides: true,//设定为true时，active slide会居中，而不是默认状态下的居左
            navigation: {
                nextEl: '.swiper-button-next',
                prevEl: '.swiper-button-prev',
            },//使用前进后退按钮
            loop : true,//true可循环
            on: {
                //callbacks 回调函数
              slideChangeTransitionStart: function(){
                if(this.activeIndex===1 || this.activeIndex===5){
                    $('.allAct').css('display','flex');
                    $('.allAct').siblings().hide();
                }else if(this.activeIndex===2){
                    //如果写$('.allAct2').show()会有问题,show把flex给干掉了，因为我用的是弹性布局
                    $('.allAct2').css('display','flex');
                    $('.allAct2').siblings().hide();
                }else if(this.activeIndex===3){
                    $('.allAct3').css('display','flex');
                    $('.allAct3').siblings().hide();
                }else if(this.activeIndex===0 || this.activeIndex===4){
                    $('.allAct4').css('display','flex');
                    $('.allAct4').siblings().hide();
                }else{
                    console.log('未知错误');
                }
              },
            },
        });
    </script>

    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"> </script>
		<script type="text/javascript">
        var title="4S cafe大放福利";
        var desc="即日起成功入会即获120元咖啡礼券，快来免费入会！入会！会！";
        var imgUrl="http://121.40.78.200/pic/act/cover/4scafe_logo.png";
        var linkUrl = "http://carnt.carnettong.com:8088/CARNT/desc/cafeMember/rights.html";
        var u = navigator.userAgent;
		var isAndroids = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; // android终端
		var isiOSs = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
		var urls='';
		var appid='';
		if(isAndroids){
			urls='../../OAuth/getAccess_token.action';
			appid='wxf71262a112685c25';
		}else if(isiOSs){
			urls='../../OAuth/getAccess_tokenIPHONE.action';
			appid='wx054c6f61cacfa911';
		}
				//获取分享的文案
				var timestamp;
				var nonceStr;
				var signature;
				//这个URL是你当前页面的url
				var json = {
								'url' : 'http://carnt.carnettong.com:8088/CARNT/desc/cafeMember/rights.html' + location.search 
							}
					$.ajax({
								type : "post",
								async:false,
								dataType : "json",
								url : urls,
								data : json,
								success : function(data) {
									timestamp=data.NOW_TIME;
									nonceStr=data.NONCESTR;
									signature=data.SKEY;
								}
								});
				
			  wx.config({
			      debug: false, // 开启调试模式,false调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
			    appId: appid, // 必填，公众号的唯一标识
			    timestamp: timestamp, // 必填，生成签名的时间戳
			    nonceStr: nonceStr, // 必填，生成签名的随机串
			    signature: signature,// 必填，签名，见附录1
			      jsApiList: [
			        'onMenuShareTimeline',
			        'onMenuShareAppMessage',
			        'hideOptionMenu',
			        'showOptionMenu'
			      ]
			  });
			  wx.ready(function () {
			 wx.onMenuShareAppMessage({
			      title: title,
			    desc: desc,
			    link: linkUrl,
			    imgUrl: imgUrl,
			    trigger: function (res) {
			      },
			      success: function (res) {
			    	  shareRecord('10618');
			      },
			      cancel: function (res) {
			      },
			      fail: function (res) {
			        alert(JSON.stringify(res));
			      }
			}); 
			
			  //分享朋友圈
			  wx.onMenuShareTimeline({
			     title: title,
			    desc: desc,
			    link: linkUrl,
			    imgUrl: imgUrl,
			    trigger: function (res) {
			      },
			      success: function (res) {
			    	  shareRecord('10618');
			      },
			      cancel: function (res) {
			      },
			      fail: function (res) {
			        alert(JSON.stringify(res));
			      }
			}); 
			});
		</script>
</body>
</html>
